<template>
    <div class="user-list">
        <!-- <h2 v-if="(userList.length==0)">当前还没有用户</h2> -->
        <el-table :data="userList" style="width: 100%">
      <el-table-column prop="id" label="id" >
      </el-table-column>
      <el-table-column prop="account" label="账号">
      </el-table-column>
        <el-table-column prop="password" label="密码">
      </el-table-column>
        <el-table-column prop="nickname" label="昵称">
      </el-table-column>
    </el-table>
    </div>
</template>

<script>
import axios from 'axios'
    export default {
        data(){
            return{
                userList:[]
            }
        },
        methods:{
           async getUserList(){
                const {data:res} = await axios.get('/user')
                this.userList = res
            }
        },
        created(){
           this.getUserList()
        }
        
    }
</script>

<style lang="less" scoped>
.user-list{
    display: flex;
    justify-content: center;
}
el-table{
    width: 300px;

    el-table-column{
        width: 70px;
    }

}
</style>
